package com.cms.action;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.apache.commons.lang.StringUtils;

import com.action.DefaultAction;
import com.cms.manager.CategoryManager;
import com.cms.manager.CpInfoManager;
import com.cms.model.AppChannelApkInfo;
import com.cms.model.AppInfo;
import com.cms.model.AppPointOfBilling;
import com.cms.model.AppScreenshot;
import com.cms.model.AppVersionInfo;
import com.cms.model.Category;
import com.cms.model.CpInfo;
import com.cms.model.TerraceInfo;
import com.cms.service.AppChannelApkInfoServiceImpl;
import com.cms.service.AppInfoService;
import com.cms.service.AppInfoServiceImpl;
import com.cms.service.AppPointOfBillingServiceImpl;
import com.cms.service.AppVersionInfoServiceImpl;
import com.cms.service.TerraceInfoService;
import com.cms.service.TerraceInfoServiceImpl;
import com.util.AnalysisApk;
import com.util.Config;
import com.util.ConfigUtil;
import com.util.FileDigest;
import com.util.Util;


/**   
 *   
 * @author zhanghusong   
 */
public class AppInfoAction extends DefaultAction {

	private static final long serialVersionUID = 1L;
	
	public AppInfoAction()
	{
	}
	AppInfo model;
	String type="";
	String msg="";
	AppInfoService service = new AppInfoServiceImpl();
	int cpid;
	int categoryparentid;
	int categoryid;
	String appName;
	int appversionid;
	int channelapkid;
	List<AppInfo> list;
	List<CpInfo> cplist;
	List<Category> caplist;
	List<Category> calist;
	List<AppScreenshot> aslist;
	AppScreenshot asmodel = new AppScreenshot();
	Map<String,List<AppPointOfBilling>> pointsmap;
	//平台列表
	private List<TerraceInfo> terraceNameList;
	private TerraceInfoService terraceservice = new TerraceInfoServiceImpl();
	
	public void getztree(){
		String appnumber = model.getAppnumber();
		List<AppVersionInfo> apvlist = new AppVersionInfoServiceImpl().getAppVersionInfoByAppNumber(appnumber);
		List<AppChannelApkInfo> chapplist = new AppChannelApkInfoServiceImpl().getAppChannelApkByAppnumber(appnumber);
		
		AppInfo app = service.getAppInfoByAppNumber(appnumber);
		List<AppScreenshot> aslist = service.getAppScreenshotByAppNumber(appnumber);
		List<String> titlist = new ArrayList<String>();
		titlist.add("{name:'"+app.getAppname()+"',id:'0',pId:'0',open:true,isParent:true}");
		titlist.add("{name:'游戏Apk',id:'1',pId:'0',type:'4',appnumber:'"+appnumber+"',geren:'0',isParent:true}");
		titlist.add("{name:'游戏图标',id:'2',pId:'0',type:'0',appnumber:'"+appnumber+"',geren:'0',isParent:true}");
		titlist.add("{name:'游戏描述',id:'3',pId:'0',type:'1',appnumber:'"+appnumber+"',geren:'0',isParent:true}");
		titlist.add("{name:'游戏截图',id:'4',pId:'0',type:'2',appnumber:'"+appnumber+"',geren:'0',isParent:true}");
		titlist.add("{name:'其它',id:'5',pId:'0',type:'3',appnumber:'"+appnumber+"',geren:'0',isParent:true}");
		
		Map<String,String> apvcache = new HashMap<String,String>();
		List<String> cache = new ArrayList<String>();
		int b=10;
		int size = aslist.size();
		for (int i = 0; i < size; i++) {
			AppScreenshot as = aslist.get(i);
			String appversionnumber = as.getAppversionnumber();
			String channelapknumber = as.getChannelappnumber();
			String type = as.getType();
			String geren=as.getGenre();
			String tmp_type="";
			
			if("4".equals(type)){
				tmp_type="1";
			}else if("0".equals(type)){
				tmp_type="2";
			}else if("1".equals(type)){
				tmp_type="3";
			}else if("2".equals(type)){
				tmp_type="4";
			}else{
				tmp_type="5";
			}
			
			String apvtype = appversionnumber+"_"+tmp_type;
			if(!apvcache.containsKey(apvtype)){
				apvcache.put(apvtype, String.valueOf(b+i));
			}
			
			if("1".equals(geren)){//appversion
				String tmp_str = appversionnumber+"_"+tmp_type;
				if(cache.contains(tmp_str)){
					continue;
				}
				cache.add(tmp_str);
				for (AppVersionInfo apv : apvlist) {
					if(appversionnumber.equals(apv.getAppversionnumber())){
						titlist.add("{name:'"+apv.getAppname()+"',id:'"+apvcache.get(apvtype)+"',pId:'"+tmp_type+"',type:'"+type+"',appversionnumber:'"+appversionnumber+"',geren:'1',isParent:true}");
						break;
					}
				}
			}else if("2".equals(geren)){//channelapk
				String tmp_str = channelapknumber+"_"+tmp_type;
				if(cache.contains(tmp_str)){
					continue;
				}
				cache.add(tmp_str);
				for (AppChannelApkInfo chapp : chapplist) {
					if(channelapknumber.equals(chapp.getChannelapknumber())){
						titlist.add("{name:'"+chapp.getAppname()+"',id:'"+100*(i+1)+"',pId:'"+apvcache.get(apvtype)+"',type:'"+type+"',channelapknumber:'"+channelapknumber+"',geren:'2',isParent:true}");
						break;
					}
				}
				//判断 是否 存在相关版本
				tmp_str = appversionnumber+"_"+tmp_type;
				if(cache.contains(tmp_str)){
					continue;
				}
				cache.add(tmp_str);
				for (AppVersionInfo apv : apvlist) {
					if(appversionnumber.equals(apv.getAppversionnumber())){
						titlist.add("{name:'"+apv.getAppname()+"',id:'"+apvcache.get(apvtype)+"',pId:'"+tmp_type+"',type:'"+type+"',appversionnumber:'"+appversionnumber+"',geren:'1',isParent:true}");
						break;
					}
				}
			}
		}
		try {
			getResponse().setContentType("text/javascript;charset=utf-8");
			PrintWriter pw = getResponse().getWriter();
			pw.write(JSONArray.fromObject(titlist).toString());
			pw.flush();
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String getappscreenshot(){
		aslist = service.getAppScreenshotByModel(asmodel);
		return SUCCESS;
	}
	public String show1(){
		return SUCCESS;
	}
	public String list()
	{
		list = service.queryAppInfo(cpid, categoryparentid, categoryid, appName);
		cplist = CpInfoManager.getInstance().getCpInfos();
		caplist = CategoryManager.getInstance().getCategorys();	
		//取计费点
		pointsmap = new HashMap<String, List<AppPointOfBilling>>();
		List<AppPointOfBilling> pointlist = new AppPointOfBillingServiceImpl().getAppPointOfBillings();
		for (AppInfo app : list) {
			//String ponint="";
			app.setTerraceInfo("");
			for (AppPointOfBilling item : pointlist) {
				if(app.getAppnumber().equals(item.getAppnumber())){
					/*if(ponint.length()>70){
						app.setTerraceInfo(ponint.substring(0,ponint.length()-2));
						break;
					}else{
						ponint+=item.getPointofbillingname()+"("+item.getFee()+")"+"\t|\t";
					}*/
					if(!pointsmap.containsKey(app.getAppnumber()))
						pointsmap.put(app.getAppnumber(), new ArrayList<AppPointOfBilling>());
					pointsmap.get(app.getAppnumber()).add(item);
				}
			}
		}
		return SUCCESS;
	}
	/**
	 * 根据平台的id查找平台的name
	 * @param ids
	 * @param l
	 * @return String
	 */
	public String terraceIdsToName(String ids) {
		String name = "," + ids + ",";
		//平台列表
		terraceNameList = terraceservice.getQuelyTerraceNames();
		for (TerraceInfo t : terraceNameList) {
			if (name.indexOf("," + t.getId() + ",") != -1) 
				name = name.replace("," + t.getId() + ",", "," + t.getOperatorsName() + ",");
		}
		return name.substring(1, name.length() - 1);
	}
	public String show()
	{
		cplist = CpInfoManager.getInstance().getCpInfos();
		caplist = CategoryManager.getInstance().getCategorys();
		if(type.equals("update"))
		{
			model = service.getAppInfoByAppNumber(model.getAppnumber());
			//aslist = service.getAppScreenshotByAppNumber(model.getAppnumber());
			calist = new ArrayList<Category>();
			for(int i =0;i<caplist.size();i++)
			{
				if(caplist.get(i).getParentId().equals(""+model.getCategoryparentid()))
				{
					calist.add(caplist.get(i));
				}
			}
		}
		else
		{
			model  = new AppInfo();
			model.setAppnumber(Util.genAppNumber());
			model.setAppstatus("0");
		}
		return SUCCESS;
	}
	public String save()
	{
		if("wl".equals(msg)){
			msg = "游戏信息管理：物料添加成功";
			return SUCCESS;
		}
		if(type.equals("insert"))
		{
			model.setCreateuser(getAdminLoginName());
			model.setCreatedate(Util.dateToString(new Date()));
			model.setAppmd5(model.getRefilename());
			if(service.saveAppInfo(model))
				msg = "游戏信息管理：添加成功";
			else
				msg = "游戏信息管理：添加失败！请重新添加！";
		}
		else if(type.equals("update"))
		{
			model.setAppmd5(model.getRefilename());
			if(service.updateAppInfo(model))
				msg = "游戏信息管理：更新成功！";
			else
				msg = "游戏信息管理：更新失败！请重新更新！";
			type = "upd";
		}
		else if(type.equals("del"))
		{
			if(service.deleteAppInfo(model))
				msg = "游戏信息管理：删除成功！";
			else
				msg = "游戏信息管理：删除失败！请重新删除！";
		}
		return SUCCESS;
	}
	private File Filedata;
	private String FiledataFileName;
	private String FiledataContentType;
	private String appscreenshotid;
	private String appscreenshoturl;
	public String saveoffonline()
	{
		if("0".equals(model.getAppstatus()))
			model.setAppstatus("1");
		else if("1".equals(model.getAppstatus()))
			model.setAppstatus("0");
		service.saveAppInfoStatus(model);
		return SUCCESS;
	}
	public String channegcategory()
	{
		caplist = CategoryManager.getInstance().getCategorys();
		calist = new ArrayList<Category>();
		for(int i =0;i<caplist.size();i++)
		{
			if(caplist.get(i).getParentId().equals(""+model.getCategoryparentid()))
			{
				calist.add(caplist.get(i));
			}
		}
		return SUCCESS;
	}
	public String uploadscreenshot()
	{
		if(Filedata!=null)
		{
			String reiconname = FileDigest.getFileMD5(Filedata);
			String filesrc = ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
			"/";
			File f = new File(filesrc);
			if(!f.exists()){
				f.mkdir();
			}
			filesrc+=reiconname;
			saveUploadFile(Filedata,filesrc);
			AppScreenshot as = new AppScreenshot();
			as.setId(-1);
			as.setGenre("0"); //0代表游戏信息
			as.setType("2");
			as.setAppnumber(model.getAppnumber());
			as.setImgname(FiledataFileName);
			as.setImgrename(reiconname);
			as.setImgsrc(filesrc);
			service.saveAppScreenshot(as);
			aslist = service.getAppScreenshotByAppNumber(model.getAppnumber());
			appscreenshotid = ""+as.getId();
			appscreenshoturl = reiconname;
		}
		return SUCCESS;
	}
	public String uploadapp()
	{
		if(Filedata!=null)
		{
			String appnumber = model.getAppnumber();
			String reiconname = FileDigest.getFileMD5(Filedata);
			String filesrc = ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
			"/app/";
			File f = new File(filesrc);
			if(!f.exists()){
				f.mkdir();
			}
			filesrc+=reiconname;
			try {
				String[] st = AnalysisApk.unZip(Filedata, "");
				String packagename = st[1];
				//检查上传文件包名
				if(packagename!=null&&!"".equals(packagename)){
					model = service.getAppInfoByAppNumber(appnumber);
					if(!packagename.equals(model.getApppackage())){
						getResponse().setContentType("text/javascript;charset=utf-8");
						PrintWriter pw = getResponse().getWriter();
						pw.write("package");
						pw.flush();
						pw.close();
						return null;
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
			saveUploadFile(Filedata,filesrc);
			AppScreenshot as = new AppScreenshot();
			as.setId(-1);
			as.setGenre("0");
			as.setType("4"); //代表apk
			as.setAppnumber(appnumber);
			as.setImgname(FiledataFileName);
			as.setImgrename(reiconname);
			as.setImgsrc(filesrc);
			service.saveAppScreenshot(as);
			appscreenshotid = ""+as.getId();
			appscreenshoturl = reiconname;
			model = new AppInfo();
			model.setRefilename(FiledataFileName);
		}
		return SUCCESS;
	}
	public String uploadicon()
	{
		if(Filedata!=null)
		{
			String reiconname = FileDigest.getFileMD5(Filedata);
			String filesrc = ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
			"/icon/";
			File f = new File(filesrc);
			if(!f.exists()){
				f.mkdir();
			}
			filesrc+=reiconname;
			saveUploadFile(Filedata,filesrc);
			AppScreenshot as = new AppScreenshot();
			as.setId(-1);
			as.setGenre("0");
			as.setType("0");
			as.setAppnumber(model.getAppnumber());
			as.setImgname(FiledataFileName);
			as.setImgrename(reiconname);
			as.setImgsrc(filesrc);
			service.saveAppScreenshot(as);
			appscreenshotid = ""+as.getId();
			appscreenshoturl = reiconname;
			
		}
		return SUCCESS;
	}
	public String uploadremark()
	{
		if(Filedata!=null)
		{
			String reiconname = FileDigest.getFileMD5(Filedata);
			String filesrc = ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
			"/remark/";
			File f = new File(filesrc);
			if(!f.exists()){
				f.mkdir();
			}
			filesrc+=reiconname;
			saveUploadFile(Filedata,filesrc);
			AppScreenshot as = new AppScreenshot();
			as.setId(-1);
			as.setGenre("0");
			as.setType("1");
			as.setAppnumber(model.getAppnumber());
			as.setImgname(FiledataFileName);
			as.setImgrename(reiconname);
			as.setImgsrc(filesrc);
			service.saveAppScreenshot(as);
			appscreenshotid = ""+as.getId();
			appscreenshoturl = reiconname;
			model = new AppInfo();
			model.setRefilename(FiledataFileName);
		}
		return SUCCESS;
	}
	public String uploadremark1()
	{
		if(Filedata!=null)
		{
			String reiconname = FileDigest.getFileMD5(Filedata);
			String filesrc = ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
			"/remark1/";
			File f = new File(filesrc);
			if(!f.exists()){
				f.mkdir();
			}
			filesrc+=reiconname;
			saveUploadFile(Filedata,filesrc);
			AppScreenshot as = new AppScreenshot();
			as.setId(-1);
			as.setGenre("0");
			as.setType("3");
			as.setAppnumber(model.getAppnumber());
			as.setImgname(FiledataFileName);
			as.setImgrename(reiconname);
			as.setImgsrc(filesrc);
			service.saveAppScreenshot(as);
			appscreenshotid = ""+as.getId();
			appscreenshoturl = reiconname;
			model = new AppInfo();
			model.setRefilename(FiledataFileName);
		}
		return SUCCESS;
	}
	public String deletescreenshot()
	{
		if(appscreenshotid!=null && appscreenshotid.length()>0)
		{
			AppScreenshot as = new AppScreenshot();
			as.setId(Integer.parseInt(appscreenshotid));
			service.deleteAppScreenshot(as);
		}
		return SUCCESS;
	}
	public String d()
	{
		try {
			HttpServletResponse response = super.getResponse();
			InputStream is = new BufferedInputStream(new FileInputStream(ConfigUtil.get(Config.SECTIONMANAGE, Config.KEY_CP_APP_SAVE_PATH) + 
					"/"+appscreenshoturl));
			byte[] b = new byte[is.available()];
			is.read(b);
			is.close();
			
			String fileName = "1111";
			if(model!=null&&model.getRefilename()!=null&&!"".equals(model.getRefilename())){
				fileName = new String(model.getRefilename().getBytes(),"utf-8");
			}
			
	    	response.setContentType("application/octet-stream");
	    	response.setHeader("Location", fileName);
	    	response.setHeader("Content-Disposition", "attachment; filename=" + new String(fileName.getBytes("gb2312"), "ISO8859-1"));
	    	OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
	    	outputStream.write(b);
	    	outputStream.flush();
	    	outputStream.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	//下载apk
	public  void downApp(){
		AppInfo info=null;
		
		if(!"".equals(model.getAppnumber())){
			 info= service.getAppInfoByAppNumber(model.getAppnumber());
		}		
		String path=info.getAppfilesrc();//文件路径
		if(!path.equals("")){
			// path是指欲下载的文件的路径。
	        File file = new File(path);
	        // 取得文件名。
	        String filename = info.getAppfilename();//file.getName();
	        // 取得文件的后缀名。
	        String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
	        try{
		        // 以流的形式下载文件。
		        InputStream fis = new BufferedInputStream(new FileInputStream(path));
		        byte[] buffer = new byte[fis.available()];
		        fis.read(buffer);
		        fis.close();
		        
		        // 清空response
		        this.getResponse().reset();
		        // 设置response的Header
		        this.getResponse().addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
		        this.getResponse().addHeader("Content-Length", "" + file.length());
		        OutputStream toClient = new BufferedOutputStream(this.getResponse().getOutputStream());
		        this.getResponse().setContentType("application/octet-stream");
		        toClient.write(buffer);
		        toClient.flush();
		        toClient.close();
		    } catch (IOException ex) {
		    	ex.printStackTrace();
		    }
			}
		else{
			msg = "您还没有上传apk,请上传aqk";
		}
	}
	
	public  void downscreenshot(){
		AppScreenshot info=null;
		
		if(!"".equals(appscreenshotid)){
			 info= service.getAppScreenshotById(appscreenshotid);
		}		
		String path=info.getImgsrc();//文件路径
		if(!path.equals("")){
			// path是指欲下载的文件的路径。
	        File file = new File(path);
	        // 取得文件名。
	        String filename = info.getImgname();//file.getName();
	        try{
		        // 以流的形式下载文件。
		        InputStream fis = new BufferedInputStream(new FileInputStream(path));
		        byte[] buffer = new byte[fis.available()];
		        fis.read(buffer);
		        fis.close();

		        filename = encodeChineseDownloadFileName(getRequest(),filename);
		        // 清空response
		        this.getResponse().reset();
		        // 设置response的Header
		        this.getResponse().addHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", filename));
		        this.getResponse().addHeader("Content-Length", "" + file.length());
		        OutputStream toClient = new BufferedOutputStream(this.getResponse().getOutputStream());
		        this.getResponse().setContentType("application/octet-stream");
		        toClient.write(buffer);
		        toClient.flush();
		        toClient.close();
		    } catch (IOException ex) {
		    	ex.printStackTrace();
		    }
		}
	}
	/** 
	 * 对文件流输出下载的中文文件名进行编码 屏蔽各种浏览器版本的差异性 
	 * @throws UnsupportedEncodingException  
	 */
	public static String encodeChineseDownloadFileName(  
            HttpServletRequest request, String pFileName) throws UnsupportedEncodingException {  
          
         String filename = null;    
            String agent = request.getHeader("USER-AGENT");    
            if (null != agent){    
                if (-1 != agent.indexOf("Firefox")) {//Firefox    
                    filename = "=?UTF-8?B?" + (new String(org.apache.commons.codec.binary.Base64.encodeBase64(pFileName.getBytes("UTF-8"))))+ "?=";    
                }else if (-1 != agent.indexOf("Chrome")) {//Chrome    
                    filename = new String(pFileName.getBytes(), "ISO8859-1");    
                } else {//IE7+    
                    filename = java.net.URLEncoder.encode(pFileName, "UTF-8");    
                    filename = StringUtils.replace(filename, "+", "%20");//替换空格    
                }    
            } else {    
                filename = pFileName;    
            }    
            return filename;   
    }  
	public String appscreenshotreload(){
		String genre = asmodel.getGenre();
		if("1".equals(genre)){
			aslist = service.getAppScreenshotByAppVersionNumber(asmodel.getAppversionnumber(), asmodel.getType());
		}else if("2".equals(genre)){
			aslist = service.getAppScreenshotBychannelapkNumber(asmodel.getChannelappnumber(), asmodel.getType());
		}
		return "screenshotreload";
	}
	public void ztreeTitle(){
		try {
			List<String> titlelist = new ArrayList<String>();
			titlelist.add("{id:1,pId:0,name:\"游戏截图\",isParent:true,open:true}");
			titlelist.add("{id:2,pId:1,name:\"发行版本\",isParent:true}");
			titlelist.add("{id:3,pId:1,name:\"渠道包\",isParent:true}");
			aslist = service.getAppScreenshotByAppNumber(model.getAppnumber());
			List<AppVersionInfo> apvlist = new AppVersionInfoServiceImpl().getAppVersionInfoByAppNumber(model.getAppnumber());
			List<AppChannelApkInfo> apclist = new AppChannelApkInfoServiceImpl().getAppChannelApkByAppnumber(model.getAppnumber());
			List<String> cache = new ArrayList<String>();
			String str="";
			int i=4;
			for (AppScreenshot item : aslist) {
				if(item.getAppversionnumber()!=null&&!"".equals(item.getAppversionnumber())&&"2".equals(item.getType())){ //截图type:2,版本，渠道包中appversionnumber不能为空
					if(item.getChannelappnumber()!=null&&!"".equals(item.getChannelappnumber())){
						if(cache.contains(item.getChannelappnumber())){continue;}
						for (AppChannelApkInfo appChannelApkInfo : apclist) {
							if(appChannelApkInfo.getChannelapknumber().equals(item.getChannelappnumber())){
								str="{id:"+i+",pId:3,name:'"+appChannelApkInfo.getAppname()+"',genre:'2',type:'2',channelappnumber:'"+appChannelApkInfo.getChannelapknumber()+"'}";
								cache.add(item.getChannelappnumber());
								break;
							}
						}
					}else{
						if(cache.contains(item.getAppversionnumber())){continue;}
						for (AppVersionInfo appVersionInfoInfo : apvlist) {
							if(appVersionInfoInfo.getAppversionnumber().equals(item.getAppversionnumber())){
								str="{id:"+i+",pId:2,name:'"+appVersionInfoInfo.getAppname()+"',genre:'1',type:'2',appversionnumber:'"+appVersionInfoInfo.getAppversionnumber()+"'}";
								cache.add(appVersionInfoInfo.getAppversionnumber());
								break;
							}
						}
					}
					i++;
					titlelist.add(str);
				}
			}
			getResponse().setContentType("text/javascript;charset=utf-8");
			PrintWriter pw = getResponse().getWriter();
			pw.write(JSONArray.fromObject(titlelist).toString());
			pw.flush();
			pw.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String getAppscreenshotid() {
		return appscreenshotid;
	}
	public void setAppscreenshotid(String appscreenshotid) {
		this.appscreenshotid = appscreenshotid;
	}
	public String getAppscreenshoturl() {
		return appscreenshoturl;
	}
	public void setAppscreenshoturl(String appscreenshoturl) {
		this.appscreenshoturl = appscreenshoturl;
	}
	public AppInfo getModel() {
		return model;
	}
	public void setModel(AppInfo model) {
		this.model = model;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public int getCpid() {
		return cpid;
	}
	public void setCpid(int cpid) {
		this.cpid = cpid;
	}
	public int getCategoryparentid() {
		return categoryparentid;
	}
	public void setCategoryparentid(int categoryparentid) {
		this.categoryparentid = categoryparentid;
	}
	public int getCategoryid() {
		return categoryid;
	}
	public void setCategoryid(int categoryid) {
		this.categoryid = categoryid;
	}
	public String getAppName() {
		return appName;
	}
	public void setAppName(String appName) {
		this.appName = appName;
	}
	public List<AppInfo> getList() {
		return list;
	}
	public void setList(List<AppInfo> list) {
		this.list = list;
	}
	public List<CpInfo> getCplist() {
		return cplist;
	}
	public void setCplist(List<CpInfo> cplist) {
		this.cplist = cplist;
	}
	public List<Category> getCalist() {
		return calist;
	}
	public void setCalist(List<Category> calist) {
		this.calist = calist;
	}
	public File getFiledata() {
		return Filedata;
	}
	public void setFiledata(File filedata) {
		Filedata = filedata;
	}
	public String getFiledataFileName() {
		return FiledataFileName;
	}
	public void setFiledataFileName(String filedataFileName) {
		FiledataFileName = filedataFileName;
	}
	public String getFiledataContentType() {
		return FiledataContentType;
	}
	public void setFiledataContentType(String filedataContentType) {
		FiledataContentType = filedataContentType;
	}
	public List<AppScreenshot> getAslist() {
		return aslist;
	}
	public void setAslist(List<AppScreenshot> aslist) {
		this.aslist = aslist;
	}
	public List<Category> getCaplist() {
		return caplist;
	}
	public void setCaplist(List<Category> caplist) {
		this.caplist = caplist;
	}
	public List<TerraceInfo> getTerraceNameList() {
		return terraceNameList;
	}
	public void setTerraceNameList(List<TerraceInfo> terraceNameList) {
		this.terraceNameList = terraceNameList;
	}
	public Map<String, List<AppPointOfBilling>> getPointsmap() {
		return pointsmap;
	}
	public void setPointsmap(Map<String, List<AppPointOfBilling>> pointsmap) {
		this.pointsmap = pointsmap;
	}
	public AppScreenshot getAsmodel() {
		return asmodel;
	}
	public void setAsmodel(AppScreenshot asmodel) {
		this.asmodel = asmodel;
	}
	public int getAppversionid() {
		return appversionid;
	}
	public void setAppversionid(int appversionid) {
		this.appversionid = appversionid;
	}
	public int getChannelapkid() {
		return channelapkid;
	}
	public void setChannelapkid(int channelapkid) {
		this.channelapkid = channelapkid;
	}
	
}
